package com.sikaryofficial.information.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author : qinjinyuan
 * @desc : 活动类型枚举
 * @date : 2023/11/04 10:08
 */
@Getter
@AllArgsConstructor
public enum ArticleDataSyncBusinessTypeEnum {
    /**
     * 消息类型 1-文章,
     */
    ARTICLE(1, ArticleDataSyncConstant.ARTICLE, "文章"),
    /**
     * 消息类型 2-文章推荐
     */
    ARTICLE_RECOMMEND(2, ArticleDataSyncConstant.ARTICLE_RECOMMEND, "文章推荐"),
    /**
     * 消息类型 3-产业新闻
     */
    INDUSTRY_NEWS(3, ArticleDataSyncConstant.INDUSTRY_NEWS, "产业新闻");

    private final Integer code;
    private final String value;
    private final String desc;

    public static ArticleDataSyncBusinessTypeEnum getNameByCode(Integer code) {

        return Arrays.stream(ArticleDataSyncBusinessTypeEnum.values())
                .filter(pointRuleEnum -> Objects.nonNull(code) && pointRuleEnum.getCode().equals(code))
                .findFirst().orElse(null);

    }

}
